<template>
    <div>
      <paperHiddenApply :viewState="true" :row="row" @approvelParam="getApprovelDetail"></paperHiddenApply>
      <!-- 导师审批工作流 -->
      <!-- <h2 class="edu-page-title">{{this.$t('paperBlindTrial.tutorRecordList')}}</h2> -->
      <auditProgress :data="auditList"></auditProgress>
      <!-- 盲审专员审批工作流 -->
      <!-- <div v-if="blindAuditList.length" style="margin-top: 10px;">
        <h2 class="edu-page-title">{{this.$t('paperBlindTrial.blindRecordList')}}</h2>
        <auditProgress :data="blindAuditList"></auditProgress>
      </div> -->
    </div>
</template>

<script>
import paperHiddenApply from './paperHiddenApply';
import auditProgress from '../common/auditProgress';
import { approvelDetail } from "common/src/api/approval";
export default {
    components: {
      paperHiddenApply,
      auditProgress
    },
    mixins: [],
    props: {
      row: {
        type: Object,
        default: {}
      }
    },
    data() {
        return {
          auditList: [], // 审批记录
        };
    },
    computed: {

    },
    created() {

    },
    mounted() {
    },
    methods: {
      back() {
          this.$emit('emit:back');
      },
      // 获取审批记录
      getApprovelDetail (row, type = 'one') {
        // 如果盲审专员工作流存在，需要查盲审审核记录
        let param = {
          no: type === 'second' ? row.workflowBlindNo : row.workflowNo
        };
        if (!param.no || param.no === '') {
            return;
        }
        approvelDetail(param).then(res => {
          if (res && res.data) {
            let historyList = _.cloneDeep(res.data.listApproveHistory);
            if (type === 'second') {
              historyList[0].content = '发起盲审专员审批流程';
              this.auditList = this.auditList.concat(historyList);
              return;
            }
            this.auditList = historyList;
            if (row.workflowBlindNo) {
              this.getApprovelDetail(row, 'second');
            }
          }
        });
      },
    }
};
</script>

<style scoped lang="scss">
.con {
    background-color: white;
    padding: 20px;
    &_title {
        width: 100%;
        border-bottom: solid #ccc 2px;
        padding-bottom: 20px;
    }
    &_footer {
        display: flex;
        flex-direction: row-reverse;
        border-top: solid #ccc 1px;
        padding-top: 10px;
    }
    &_apply {
        width: 900px;
    }
    &_footer {
        display: flex;
        flex-direction: row-reverse;
    }
}
</style>
